package principle.flyweight;

import java.util.HashMap;
import java.util.Map;

/**
 * @author malguy-wang sir
 * @create ---
 */
public class websiteFactory {
    //一个map，充当池
    private Map<String,concreteWebsite> pool = new HashMap<>();
    public website getWebsite(String type){
        if(!pool.containsKey(type)) pool.put(type,new concreteWebsite(type));//如果没有就创建
        return (website) pool.get(type); }
    //获取网站分类的总数
    public int getWebsiteSize(){ return pool.size(); }
}
